package com.spring.sso.common.enums;

/**
 * @author : pangfuzhong
 * @description
 * @date : 2021/9/25 17:24
 */
public enum AuthChannelEnum {

    // 三方登陆
    WEI_XIN("WEI_XIN", "微信App登陆"),
    WEI_XIN_APPLET("WEI_XIN_APPLET", "微信小程序登陆"),

    DING_DING("DING_DING", "钉钉"),
    DING_DING_APPLET("DING_DING_APPLET", "钉钉小程序登陆"),

    ALIPAY("ALIPAY", "支付宝登陆"),
    ALIPAY_APPLET("ALIPAY_APPLET", "支付宝小程序登陆"),

    WEI_BO("WEI_BO", "微博"),
    QQ("QQ", "QQ"),

    OPEN_PLATFORM("OPEN_PLATFORM", "开放平台登陆"),

    // 传统登陆
    PASSWORD("PASSWORD", "密码登陆"),

    // 验证码登陆
    VERIFICATION("VERIFICATION", "验证码");

    private String code;
    private String desc;

    public String getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    AuthChannelEnum(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static AuthChannelEnum getByCode(String code) {
        for (AuthChannelEnum st : AuthChannelEnum.values()) {
            if ( st.code.equals(code)) {
                return st;
            }
        }
        return null;
    }
}
